<?php

namespace app\api\controller;

use app\common\lib\Param;
use app\common\lib\Show;
use app\common\lib\Str;
use app\Request;
use think\facade\Cache;
use think\response\Json;

class Represent extends ApiBase
{
    public function index(): Json
    {
        try {
            $list=(new \app\common\business\Represent())->getTreeList();
        } catch (\Exception $e) {
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        return Show::success($list);
    }

    public function detail(){
        $id=$this->request->get('id');
        if(empty($id)){
            return Show::error([],'参数错误');
        }
        try {
            $data=(new \app\common\business\Represent())->getNormalById($id);
        }catch (\Exception $e){
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        return Show::success($data);
    }


}
